cmake_minimum_required(VERSION 3.1 FATAL_ERROR)

# Set project information
project(libmodbus LANGUAGES C)
include(cmakes/BuildDefaults.cmake)

include_directories(
    ./src/
)
add_library(modbus SHARED
    ./src/modbus-data.c
    ./src/modbus-tcp.c
    ./src/modbus-rtu.c
    ./src/modbus.c
)

if(WIN32)
    target_link_libraries(modbus
                        ws2_32.dll
    )
endif()

add_executable(app 

    ./test/main.c
)

target_link_libraries(app modbus)
# src targets.
